//
//  CBNoContentView.m
//  CBAnyViewPlaceHolder
//
//  Created by Creater on 2018/10/12.
//  Copyright © 2018 Creative Bomb. All rights reserved.
//

#import "CBNoContentView.h"
#import <CoreLocation/CoreLocation.h>

@implementation CBNoContentView

/*
 @property (nonatomic, strong) UIImageView *imgViewHeader;
 @property (nonatomic, strong) UILabel *lblReminder;
 @property (nonatomic, strong) UIButton *btnReload;
 */

- (instancetype)init {
    self = [super init];
    if (self) {
    
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}


- (void)setUI {
    self.backgroundColor = UIColor.whiteColor;
    
    _imgViewHeader = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NoData"]];
    [self addSubview:_imgViewHeader];
    
    _lblReminder = [UILabel new];
    [self addSubview:_lblReminder];
    _lblReminder.text = @"NoData";

    _btnReload = [UIButton new];
    [_btnReload setBackgroundColor:UIColor.redColor];
    [self addSubview:_btnReload];
    [_btnReload setTitle:@"刷新" forState:UIControlStateNormal];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGRect selfBounds = self.bounds;
    CGSize selfSize = selfBounds.size;
    CGFloat selfWidth = selfSize.width;
    CGFloat selfHeight = selfSize.height;
    _imgViewHeader.frame = CGRectMake((selfWidth - 100) / 2.0, (selfHeight - 100) / 2.0 - 50.0, 100, 100);
    [_lblReminder setTextAlignment:NSTextAlignmentCenter];
    [_lblReminder sizeToFit];
    _lblReminder.frame = CGRectMake((selfWidth - _lblReminder.frame.size.width) / 2.0, _imgViewHeader.frame.origin.y + _imgViewHeader.frame.size.height + 10.0, _lblReminder.frame.size.width, _lblReminder.frame.size.height);
    [_btnReload setFrame:CGRectMake(40, _lblReminder.frame.origin.y + _lblReminder.frame.size.height + 10.0, selfWidth - 80.0, 49.0)];
}


@end
